<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>" charset="<?php bloginfo('charset'); ?>" />
        <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> 
        <link rel="pingback" href="<?php bloginfo('pingback url'); ?>" /> 
        <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" /> 
        <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
        <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
        <script src="https://apis.google.com/js/platform.js"></script>
        <?php
        global $cur_cat_id;
        $cur_cat_id = get_cat_id(single_cat_title("", false));
        ?>
        <title>
            <?php
            $title = wp_title('', FALSE);
            echo ($title == '') ? 'جريدة التحرير' : $title;
            ?>
        </title>
        <?php wp_head(); ?>
    </head>
    <body>
        <div class="wrapper">
            <div class="header">
                <div class="topHeader clearfix">
                    <div class="socialTopHeader clearfix">
                        <span class="f-r"> تابعنا على </span>
                        <a href="#" class="facebook_TH" target="_blank" title="Facebook"></a>
                        <a href="#" class="twitter_TH" target="_blank" title="Twitter"></a>
                        <a href="#" class="youtube_TH" target="_blank" title="Youtube"></a>
                        <a href="#" class="rss_TH" target="_blank" title="RSS"></a>
                    </div><!-- socialTopHeader -->
                    <a href="#" class="downloadNewsLet">
                        <span class="pdfImg"></span>
                        <span>تنزيل عدد اليوم</span>
                    </a>
                    <a href="#" class="ListenRadio">
                        <span class="radioImg"></span>
                        <span>أسمع راديو التحرير</span>
                    </a>
                    <form action="" method="post" class="searchForm">
                        <input type="text" name="search" value="بحــــــــــــــث" onblur="if (this.value == '') {
                                    this.value = 'بحــــــــــــــث'
                                }" onfocus="if (this.value == 'بحــــــــــــــث') {
                                            this.value = ''
                                        }" />
                        <input type="submit" value="" />
                    </form>
                </div><!-- topHeader -->

                <span class="arrowTopHeader"></span>

                <div class="inHeader clearfix">
                    <h1 class="logo"><img src="<?php bloginfo('template_url'); ?>/images/logo.jpg" alt="Tahrir News" /></h1>
                    <div class="socialInheader">
                        <a href="#" class="rss_IH" target="_blank" title="RSS">6400</a>
                        <a href="#" class="twitter_IH" target="_blank" title="Twitter">260k</a>
                        <a href="#" class="facebook_IH" target="_blank" title="Facebook">500k</a>
                        <a href="#" class="youtube_IH" target="_blank" title="Youtube">20k</a>
                        <!--<div class="g-ytsubscribe" data-channel="TahrirNewsOfficial" data-layout="full" data-count="default"></div>-->
                    </div><!-- socialInheader -->
                </div><!-- inHeader -->

                <div class="navigation">
                    <img src="<?php bloginfo('template_url'); ?>/images/logo.jpg" class="navigationLogo" alt="tahrir news" />
                    <ul class="f-r">
                        <li class="chome">
                            <a href="<?php echo get_site_url() ?>">الرئيسية</a>								
                        </li>
                        <?php
                        //print_r($current_cat);
                        $mainNavId = get_cat_ID('main nav');
                        $newsCatId = get_cat_ID('news');
                        $theArgs = array('child_of' => $mainNavId, 'hide_empty' => 0, 'orderby' => 'id');
                        $navCats = get_categories($theArgs);
                        foreach ($navCats as $navCat) {
                            $curCatId = get_cat_ID($navCat->name);
                            $args = array('category__and' => array($curCatId, $newsCatId), 'numberposts' => 3);
                            $latestPosts = get_posts($args);
                            $itemExtraClass = empty($latestPosts) ? '' : ' hasSub';
                            $colorClassName = 'c' . $navCat->slug;
                            $categoryLink = get_category_link($navCat);
                            ?>
                            <li class="<?php echo $colorClassName . $itemExtraClass; ?>">
                                <a href="<?php echo $categoryLink ?>"><?php echo $navCat->name ?></a>								
                                <?php if ($cur_cat_id == $navCat->term_id) { ?>
                                    <div class="up-triangle" style="display:block"></div>
                                <?php } ?>
                                <?php if (!empty($latestPosts)) {
                                    ?>
                                    <div class="submenu">
                                        <?php
                                        foreach ($latestPosts as $post) {
                                            ?>
                                            <a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a>
                                        <?php }
                                        ?>
                                        <a href="<?php echo get_category_link($navCat) ?>" class="navGoSection"><?php echo "مشاهدة قسم " . $navCat->name ?></a>
                                    </div><!--submenu -->
                                <?php }
                                ?>
                            </li>
                        <?php }
                        ?>
                    </ul>
                    <a href="#" class="userLogin" title="Login"></a>
                    <a href="#" class="PhotosHeader" title="Photos"></a>
                </div><!-- nabigation -->

            </div><!-- header -->